package com.hanhan.chargingpile.stations.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hanhan.chargingpile.stations.pojo.entity.ChargingPile;
import com.hanhan.chargingpile.stations.mapper.ChargingPileMapper;
import com.hanhan.chargingpile.stations.pojo.entity.ChargingStations;
import com.hanhan.chargingpile.stations.pojo.vo.ChargingPileVO;
import com.hanhan.chargingpile.stations.service.ChargingPileService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 充电桩 服务实现类
 * </p>
 *
 * @author HanHan
 * @since 2023-03-22
 */
@Service
public class ChargingPileServiceImpl extends ServiceImpl<ChargingPileMapper, ChargingPile> implements ChargingPileService {

    @Override
    public IPage<ChargingPileVO> selectChargingPileList(Page<ChargingPile> pageParam, ChargingPile chargingPile) {
        QueryWrapper<ChargingPile> queryWrapper = new QueryWrapper<>();
        queryWrapper
                .eq(chargingPile.getChargingStationsId() != null, "charging_stations_id", chargingPile.getChargingStationsId())
                .eq(chargingPile.getSerialNumber() != null, "serial_number", chargingPile.getSerialNumber())
                .eq(chargingPile.getChargingPileSpec() != null, "charging_pile_spec", chargingPile.getChargingPileSpec())
                .eq(chargingPile.getAcDc() != null,"ac_dc", chargingPile.getAcDc())
                .eq(chargingPile.getUseStatus() != false, "use_status", chargingPile.getUseStatus())
                .eq(chargingPile.getOffLineIs() != false, "off_line_is", chargingPile.getOffLineIs());
        return baseMapper.selectChargingPileList(pageParam, queryWrapper);
    }
}
